################################
# Persia Events
################################
# By WordZero & ~mw~ :thinbing:
################################

add_namespace = persia_events

country_event = { # Death of Ahmad Shah
	id = persia_events.2
	title = persia_events.2.t
	desc = persia_events.2.d
	picture = GFX_report_event_generic_funeral

	is_triggered_only = yes

	option = { # Hasan Mirza stays
		log = "[GetLogInfo]: event persia_events.2 option persia_events.2.a"
		name = persia_events.2.a
		ai_chance = {
			base = 60
			modifier = {
				factor = 0
				has_game_rule = { rule = PER_path option = PER_PATH_PATAUT }
			}
		}
		hidden_effect = {
			country_event = { id = persia_events.5 days = 1 }
		}
	}

	option = { # Hasan Mirza flees
		log = "[GetLogInfo]: event persia_events.2 option persia_events.2.b"
		name = persia_events.2.b
		ai_chance = {
			base = 40
			modifier = {
				factor = 0
				OR = {
					AND = {
						NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
						NOT = { has_game_rule = { rule = PER_path option = PER_PATH_PATAUT } }
					}
					has_game_rule = { rule = PER_new_np_path option = PER_PATH_REPUBLIC_NATPOP }
				}
			}
		}
		hidden_effect = {
			country_event = { id = persia_events.6 days = 1 }
		}
	}

	after = {
		PER_ahmad_shah_qajar = { kill_character = yes }
		PER_create_hassan = yes
		set_politics = {
			ruling_party = authoritarian_democrat
			elections_allowed = no
		}
		complete_national_focus = PER_shah_is_dead_press_f
	}
}

country_event = { # loyalists storm majlis, many politicians arrested to secure safe transition
	id = persia_events.3
	title = persia_events.3.t
	desc = persia_events.3.d

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.3 option persia_events.3.a"
		name = persia_events.3.a
		hidden_effect = {
			country_event = { id = persia_events.4 days = 2 }
		}
	}
}

country_event = { # Absolute monarchy set up
	id = persia_events.4
	title = persia_events.4.t
	desc = persia_events.4.d

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.4 option persia_events.4.a"
		name = persia_events.4.a
		set_politics = {
			ruling_party = paternal_autocrat
			elections_allowed = no
		}
		add_popularity = {
			ideology = paternal_autocrat
			popularity = 0.40
		}
		complete_national_focus = PER_long_live
	}
}

country_event = { # Mirza Stays, what happens now?
	id = persia_events.5
	title = persia_events.5.t
	desc = persia_events.5.d

	is_triggered_only = yes

	option = { # Loyalists storm the majlis, capture potential threats
		log = "[GetLogInfo]: event persia_events.5 option persia_events.5.a"
		name = persia_events.5.a
		ai_chance = {
			base = 30
			modifier = {
				factor = 0
				OR = {
					AND = {
						NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
						NOT = { has_game_rule = { rule = PER_path option = PER_PATH_PATAUT } }
					}
					has_game_rule = { rule = PER_new_np_path option = PER_PATH_REPUBLIC_NATPOP }
				}
			}
		}
		hidden_effect = {
			country_event = { id = persia_events.11 days = 1 }
		}
	}

	option = { # loyalists capture key points in the city
		log = "[GetLogInfo]: event persia_events.5 option persia_events.5.b"
		name = persia_events.5.b
		ai_chance = { base = 40 }
		hidden_effect = {
			country_event = { id = persia_events.7 days = 1 }
		}
	}

	option = { # Mirza does nothing
		log = "[GetLogInfo]: event persia_events.5 option persia_events.5.c"
		name = persia_events.5.c
		ai_chance = {
			base = 30
			modifier = {
				factor = 0
				OR = {
					AND = {
						NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
						NOT = { has_game_rule = { rule = PER_path option = PER_PATH_PATAUT } }
					}
					has_game_rule = { rule = PER_new_np_path option = PER_PATH_REPUBLIC_NATPOP }
				}
			}
		}
		hidden_effect = {
			country_event = { id = persia_events.12 days = 1 }
		}
	}
}

country_event = { # Mirza flees, what happens now?
	id = persia_events.6
	title = persia_events.6.t
	desc = persia_events.6.d

	is_triggered_only = yes

	option = { # Loyalists storm the majlis, capture potential threats
		log = "[GetLogInfo]: event persia_events.6 option persia_events.6.a"
		name = persia_events.6.a
		ai_chance = { base = 30 }
		hidden_effect = {
			country_event = { id = persia_events.3 days = 1 }
		}
	}

	option = { # loyalists capture key points in the city
		log = "[GetLogInfo]: event persia_events.6 option persia_events.6.b"
		name = persia_events.6.b
		ai_chance = {
			base = 20
			modifier = {
				factor = 0
				has_game_rule = { rule = PER_path option = PER_PATH_PATAUT }
			}
		}
		hidden_effect = {
			country_event = { id = persia_events.15 days = 1 }
		}
	}

	option = { # Mirza does nothing
		log = "[GetLogInfo]: event persia_events.6 option persia_events.6.c"
		name = persia_events.6.c
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				has_game_rule = { rule = PER_path option = PER_PATH_PATAUT }
			}
		}
		hidden_effect = {
			country_event = { id = persia_events.14 days = 1 }
		}
	}
}

country_event = { # loyalists capture key points in the city, Mirza stayed
	id = persia_events.7
	title = persia_events.7.t
	desc = persia_events.7.d

	is_triggered_only = yes

	option = { # control is secured
		log = "[GetLogInfo]: event persia_events.7 option persia_events.7.a"
		name = persia_events.7.a
		ai_chance = {
			base = 25
			modifier = {
				factor = 0
				OR = {
					OR = {
						AND = {
							NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
							NOT = { has_game_rule = { rule = PER_path option = PER_PATH_MON_SOCDEM } }
							NOT = { has_game_rule = { rule = PER_path option = PER_PATH_MON_SOCLIB } }
							NOT = { has_game_rule = { rule = PER_path option = PER_PATH_MON_SOCCON } }
							NOT = { has_game_rule = { rule = PER_path option = PER_PATH_AUTDEM } }
						}
						has_game_rule = { rule = PER_new_np_path option = PER_PATH_REPUBLIC_NATPOP }
					}
				}
			}
		}
		hidden_effect = {
			country_event = { id = persia_events.8 days = 1 }
		}
	}

	option = { # politicians unify to protect majlis
		log = "[GetLogInfo]: event persia_events.7 option persia_events.7.b"
		name = persia_events.7.b
		ai_chance = {
			base = 75
			modifier = {
				factor = 0
				OR = {
					has_game_rule = { rule = PER_path option = PER_PATH_MON_SOCDEM }
					has_game_rule = { rule = PER_path option = PER_PATH_MON_SOCLIB }
					has_game_rule = { rule = PER_path option = PER_PATH_MON_SOCCON }
					has_game_rule = { rule = PER_path option = PER_PATH_AUTDEM }
				}
			}
		}
		hidden_effect = {
			country_event = { id = persia_events.10 days = 1 }
		}
	}
}

country_event = { # constitutional monarchy
	id = persia_events.8
	title = persia_events.8.t
	desc = persia_events.8.d

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.8 option persia_events.8.a"
		name = persia_events.8.a
		set_politics = {
			ruling_party = authoritarian_democrat
			elections_allowed = yes
		}
		add_popularity = {
			ideology = authoritarian_democrat
			popularity = 0.20
		}
		complete_national_focus = PER_long_live
	}
}

country_event = { # democrat party and radsoc party unify
	id = persia_events.10
	title = persia_events.10.t
	desc = persia_events.10.d

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.10 option persia_events.10.a"
		name = persia_events.10.a
		hidden_effect = {
			country_event = { id = persia_events.17 days = 1 }
		}
	}
}

country_event = { # influential politicians and majlis predicted this, are ready to fight
	id = persia_events.11
	title = persia_events.11.t
	desc = persia_events.11.d

	is_triggered_only = yes

	option = { #civil war
		log = "[GetLogInfo]: event persia_events.11 option persia_events.11.a"
		name = persia_events.11.a
		ai_chance = { base = 30 }
		hidden_effect = {
			country_event = { id = persia_events.20 days = 1 }
		}
	}

	option = { #assassinate mirza
		log = "[GetLogInfo]: event persia_events.11 option persia_events.11.b"
		name = persia_events.11.b
		ai_chance = { base = 70 }
		hidden_effect = {
			country_event = { id = persia_events.16 days = 1 }
		}
	}
}

country_event = { # Mirza does nothing, he stayed
	id = persia_events.12
	title = persia_events.12.t
	desc = persia_events.12.d

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.12 option persia_events.12.a"
		name = persia_events.12.a
		hidden_effect = {
			country_event = { id = persia_events.8 days = 1 }
		}
	}
}

country_event = { # mirza does nothing, he left
	id = persia_events.14
	title = persia_events.14.t
	desc = persia_events.14.d

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.14 option persia_events.14.a"
		name = persia_events.14.a
		hidden_effect = {
			country_event = { id = persia_events.10 days = 1 }
		}
	}
}

country_event = { # influential politicians and majlis predicted this, are ready to fight, mirza left
	id = persia_events.15
	title = persia_events.15.t
	desc = persia_events.15.d

	is_triggered_only = yes

	option = { #civil war
		log = "[GetLogInfo]: event persia_events.15 option persia_events.15.a"
		name = persia_events.15.a
		hidden_effect = {
			country_event = { id = persia_events.20 days = 1 }
		}
	}
}

country_event = { # hazan mirza assassinated, son takes control, what he do
	id = persia_events.16
	title = persia_events.16.t
	desc = persia_events.16.d

	is_triggered_only = yes

	option = { # no negotiations, civil war
		log = "[GetLogInfo]: event persia_events.16 option persia_events.16.a"
		name = persia_events.16.a
		ai_chance = { base = 55 }
		hidden_effect = {
			country_event = { id = persia_events.20 days = 1 }
		}
	}

	option = { #son negotiates with majlis
		log = "[GetLogInfo]: event persia_events.16 option persia_events.16.b"
		name = persia_events.16.b
		ai_chance = { base = 45 }
		hidden_effect = {
			country_event = { id = persia_events.8 days = 1 }
		}
	}

	after = {
		PER_hassan_mirza_qajar = { kill_character = yes }
		PER_create_hamid = yes
	}
}

country_event = { # revolution, have to decide either socdem or radsoc
	id = persia_events.17
	title = persia_events.17.t
	desc = persia_events.17.d

	is_triggered_only = yes

	option = { # socdem wins
		log = "[GetLogInfo]: event persia_events.17 option persia_events.17.a"
		name = persia_events.17.a
		ai_chance = {
			base = 65
			modifier = {
				factor = 0
				OR = {
					has_game_rule = { rule = PER_path option = PER_PATH_RADSOC }
					has_game_rule = { rule = PER_new_np_path option = PER_PATH_REPUBLIC_NATPOP }
				}
			}
		}
		hidden_effect = {
			country_event = { id = persia_events.18 days = 1 }
		}
	}

	option = { # radsoc wins
		log = "[GetLogInfo]: event persia_events.17 option persia_events.17.b"
		name = persia_events.17.b
		ai_chance = {
			base = 35
			modifier = {
				factor = 0
				NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_RADSOC } }
			}
		}
		hidden_effect = {
			country_event = { id = persia_events.19 days = 1 }
		}
	}

	option = { # natpop wins
		log = "[GetLogInfo]: event pers.17 option pers.17.c"
		name = pers.17.c
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_game_rule = { rule = PER_path option = PER_PATH_RADSOC }
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_SOCDEM }
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_SOCLIB }
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_MARLIB }
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_SOCCON }
				}
			}
		}
		custom_effect_tooltip = new_iran_tt
		promote_character = {
    			character = PER_Abdolhossein_Teymourtash
    			ideology = national_populist
		}
		set_party_name = {
    			ideology = national_populist
   			long_name = PER_new_iran_party_long
    			name = PER_new_iran_party
		}
		set_politics = {
			ruling_party = national_populist
			elections_allowed = yes
		}
		add_popularity = {
			ideology = national_populist
			popularity = 0.35
		}
		add_popularity = {
			ideology = market_liberal
			popularity = 0.10
		}
		complete_national_focus = PER_long_live_revolution
		hidden_effect = {
			news_event = {
    				id = DESnews.4
    				days = 1
			}
		}
	}

}

country_event = { # socdem gov
	id = persia_events.18
	title = persia_events.18.t
	desc = persia_events.18.d

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.18 option persia_events.18.a"
		name = persia_events.18.a
		PER_remove_monarchy = yes
		set_politics = {
			ruling_party = social_democrat
			elections_allowed = yes
		}
		add_popularity = {
			ideology = social_democrat
			popularity = 0.10
		}
		hidden_effect = {
			news_event = { id = persia_events.110 days = 1 }
		}
		complete_national_focus = PER_long_live_revolution
	}
}

country_event = { # radsoc gov
	id = persia_events.19
	title = persia_events.19.t
	desc = persia_events.19.d

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.19 option persia_events.19.a"
		name = persia_events.19.a
		PER_remove_monarchy = yes
		set_politics = {
			ruling_party = radical_socialist
			elections_allowed = no
		}
		add_popularity = {
			ideology = radical_socialist
			popularity = 0.30
		}
		complete_national_focus = PER_long_live_revolution
		if = {
			limit = {
				OR = {
					has_completed_focus = PER_army_german
					has_completed_focus = PER_army_austria
				}
			}
			hidden_effect = {
				uncomplete_national_focus = {
					focus = PER_army_german
					uncomplete_children = yes
				}
				uncomplete_national_focus = {
					focus = PER_army_austria
					uncomplete_children = yes
				}
			}
			complete_national_focus = PER_army_france
		}
		hidden_effect = {
			news_event = { id = persia_events.111 days = 1 }
		}
	}
}

country_event = { ### CIVIL WAR ###
	id = persia_events.20
	title = persia_events.20.t
	desc = persia_events.20.d

	is_triggered_only = yes

	option = { # whoops.jpg
		log = "[GetLogInfo]: event persia_events.20 option persia_events.20.a"
		name = persia_events.20.a
		hidden_effect = {
			set_country_flag = { flag = PER_civilwar_loyalists value = 0 }
			set_country_flag = { flag = PER_civilwar_rebels value = 0 }
			country_event = { id = persia_events.21 days = 1 }
		}
	}
}

country_event = { ### CIVIL WAR ### city - Isfahan
	id = persia_events.21
	title = persia_events.21.t
	desc = persia_events.21.d

	is_triggered_only = yes

	option = { #
		log = "[GetLogInfo]: event persia_events.21 option persia_events.21.a"
		name = persia_events.21.a
		add_stability = -0.05
		add_political_power = -25
		hidden_effect = {
			random_list = {
				70 = {
					modify_country_flag = {
						flag = PER_civilwar_loyalists
						value = 1
					}
				}
				30 = {
					modify_country_flag = {
						flag = PER_civilwar_rebels
						value = 1
					}
				}
			}
		}
	}

	option = { #
		log = "[GetLogInfo]: event persia_events.21 option persia_events.21.b"
		name = persia_events.21.b
		add_political_power = -40
		hidden_effect = {
			random_list = {
				50 = {
					modify_country_flag = {
						flag = PER_civilwar_loyalists
						value = 1
					}
				}
				50 = {
					modify_country_flag = {
						flag = PER_civilwar_rebels
						value = 1
					}
				}
			}
		}
	}

	after = {
		hidden_effect = {
			country_event = { id = persia_events.22 days = 1 }
		}
	}
}

country_event = { ### CIVIL WAR ### city - Tabriz
	id = persia_events.22
	title = persia_events.22.t
	desc = persia_events.22.d

	is_triggered_only = yes

	option = { #loyalists win
		log = "[GetLogInfo]: event persia_events.22 option persia_events.22.a"
		name = persia_events.22.a
		ai_chance = { base = 20 }
		add_stability = -0.05
		add_political_power = -25
		hidden_effect = {
			random_list = {
				20 = {
					modify_country_flag = {
						flag = PER_civilwar_loyalists
						value = 1
					}
				}
				80 = {
					modify_country_flag = {
						flag = PER_civilwar_rebels
						value = 1
					}
				}
			}
		}
	}

	option = { #rebels win
		log = "[GetLogInfo]: event persia_events.22 option persia_events.22.b"
		name = persia_events.22.b
		ai_chance = { base = 80 }
		add_stability = -0.02
		add_political_power = -15
		419 = {
			if = {
				limit = { non_damaged_building_level = { building = arms_factory level > 0.9 } }
				damage_building = {
					type = arms_factory
					damage = 0.9
				}
			}
		}
		hidden_effect = {
			random_list = {
				60 = {
					modify_country_flag = {
						flag = PER_civilwar_loyalists
						value = 1
					}
				}
				40 = {
					modify_country_flag = {
						flag = PER_civilwar_rebels
						value = 1
					}
				}
			}
		}
	}

	after = {
		hidden_effect = {
			country_event = { id = persia_events.24 days = 1 }
		}
	}
}

country_event = { ### CIVIL WAR ### city - Mashhad
	id = persia_events.24
	title = persia_events.24.t
	desc = persia_events.24.d

	is_triggered_only = yes

	option = { #loyalists win
		log = "[GetLogInfo]: event persia_events.24 option persia_events.24.a"
		name = persia_events.24.a
		add_stability = -0.05
		add_war_support = -0.05
		416 = {
			if = {
				limit = { non_damaged_building_level = { building = infrastructure level > 0.9 } }
				damage_building = {
					type = infrastructure
					damage = 0.9
				}
			}
		}
		hidden_effect = {
			modify_country_flag = {
				flag = PER_civilwar_loyalists
				value = 1
			}
			country_event = { id = persia_events.26 days = 1 }
		}
	}
}

country_event = { ### CIVIL WAR ### city - Shiraz
	id = persia_events.26
	title = persia_events.26.t
	desc = persia_events.26.d

	is_triggered_only = yes

	option = { #loyalists win
		log = "[GetLogInfo]: event persia_events.26 option persia_events.26.a"
		name = persia_events.26.a
		add_stability = -0.05
		add_political_power = -25
		hidden_effect = {
			random_list = {
				50 = {
					modify_country_flag = {
						flag = PER_civilwar_loyalists
						value = 1
					}
				}
				50 = {
					modify_country_flag = {
						flag = PER_civilwar_rebels
						value = 1
					}
				}
			}
		}
	}

	option = { #rebels win
		log = "[GetLogInfo]: event persia_events.26 option persia_events.26.b"
		name = persia_events.26.b
		add_stability = -0.02
		add_war_support = -0.02
		add_political_power = -15
		412 = {
			if = {
				limit = { non_damaged_building_level = { building = infrastructure level > 0.9 } }
				damage_building = {
					type = infrastructure
					damage = 0.9
				}
			}
		}
		hidden_effect = {
			random_list = {
				75 = {
					modify_country_flag = {
						flag = PER_civilwar_loyalists
						value = 1
					}
				}
				25 = {
					modify_country_flag = {
						flag = PER_civilwar_rebels
						value = 1
					}
				}
			}
		}
	}

	after = {
		hidden_effect = {
			country_event = { id = persia_events.27 days = 1 }
		}
	}
}

country_event = { ### CIVIL WAR ### city - Bandar e'Abbas
	id = persia_events.27
	title = persia_events.27.t
	desc = persia_events.27.d

	is_triggered_only = yes

	option = { #
		log = "[GetLogInfo]: event persia_events.27 option persia_events.27.a"
		name = persia_events.27.a
		add_stability = -0.05
		add_political_power = -25
		412 = {
			if = {
				limit = { non_damaged_building_level = { building = dockyard level > 0.9 } }
				damage_building = {
					type = dockyard
					damage = 0.9
				}
			}
		}
		hidden_effect = {
			modify_country_flag = {
				flag = PER_civilwar_rebels
				value = 1
			}
			country_event = { id = persia_events.28 days = 1 }
		}
	}
}

country_event = { ### CIVIL WAR ### END
	id = persia_events.28
	title = persia_events.28.t
	desc = persia_events.28.d

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.28 option persia_events.28.a"
		name = persia_events.28.a
		add_stability = 0.1
		hidden_effect = {
			if = {
				limit = {
					has_country_flag = {
						flag = PER_civilwar_loyalists
						value > 2
					}
				}
				country_event = { id = persia_events.29 days = 1 }
			}
			if = {
				limit = {
					has_country_flag = {
						flag = PER_civilwar_rebels
						value > 2
					}
				}
				country_event = { id = persia_events.30 days = 1 }
			}
		}
	}
}

country_event = { # loyalists won civil war
	id = persia_events.29
	title = persia_events.29.t
	desc = persia_events.29.d

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.29 option persia_events.29.a"
		name = persia_events.29.a
		hidden_effect = {
			country_event = { id = persia_events.8 days = 1 }
		}
	}
}

country_event = { # rebels won the civil war
	id = persia_events.30
	title = persia_events.30.t
	desc = persia_events.30.d

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.30 option persia_events.30.a"
		name = persia_events.30.a
		hidden_effect = {
			country_event = { id = persia_events.17 days = 1 }
		}
	}
}

country_event = { # black monday hits persia
	id = persia_events.31
	title = persia_events.31.t
	desc = persia_events.31.d
	picture = GFX_report_event_gathering_protest

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			add_timed_idea = {
				idea = PER_black_monday
				days = 360
			}
			PER_decrease_two_reserve_effect = yes
		}
	}

	option = {
		log = "[GetLogInfo]: event persia_events.31 option persia_events.31.a"
		name = persia_events.31.a
		effect_tooltip = {
			add_timed_idea = {
				idea = PER_black_monday
				days = 360
			}
			PER_decrease_two_reserve_effect = yes
		}
	}
}

country_event = { # asntan qods razavi
	id = persia_events.32
	title = persia_events.32.t
	desc = persia_events.32.d
	picture = GFX_report_event_generic_read_write

	is_triggered_only = yes

	option = { # make a deal with them
		log = "[GetLogInfo]: event persia_events.32 option persia_events.32.a"
		name = persia_events.32.a
		ai_chance = { 
			base = 55 
			modifier = {
				factor = 0
				has_game_rule = { rule = PER_new_np_path option = PER_PATH_REPUBLIC_NATPOP }
			}
		}
		add_ideas = PER_asntan_qods_razavi_deal
	}

	option = { # seize their wealth
		log = "[GetLogInfo]: event persia_events.32 option persia_events.32.b"
		name = persia_events.32.b
		ai_chance = { base = 45 }
		add_political_power = -100
		add_timed_idea = {
			idea = PER_asntan_qods_razavi_seize
			days = 365
		}
		random_owned_controlled_state = {
			prioritize = { 416 }
			limit = {
				is_core_of = ROOT
				is_valid_state_for_development = yes
				free_building_slots = { building = industrial_complex size > 2 include_locked = yes }
			}
			add_extra_state_shared_building_slots = 3
			add_building_construction = {
				type = industrial_complex
				level = 3
				instant_build = yes
			}
		}
		PER_increase_two_reserve_effect = yes
	}
}

country_event = { # sheikh kazal
	id = persia_events.33
	title = persia_events.33.t
	desc = persia_events.33.d
	picture = GFX_report_event_generic_read_write

	is_triggered_only = yes

	option = { # make a deal with him
		log = "[GetLogInfo]: event persia_events.33 option persia_events.33.a"
		name = persia_events.33.a
		ai_chance = { 
			base = 50 
			modifier = {
				factor = 0
				has_game_rule = { rule = PER_new_np_path option = PER_PATH_REPUBLIC_NATPOP }
			}
		}
		add_political_power = 25
		add_ideas = PER_sheikh_kazal_deal
	}

	option = { # seize his wealth
		log = "[GetLogInfo]: event persia_events.33 option persia_events.33.b"
		name = persia_events.33.b
		ai_chance = { base = 45 }
		add_political_power = -50
		add_resource = {
			type = oil
			amount = 24
			state = 413
		}
		413 = {
			if = {
				limit = {
					is_owned_by = PER
				}
				add_extra_state_shared_building_slots = 1
				add_building_construction = {
					type = industrial_complex
					level = 1
					instant_build = yes
				}
			}
		}
		add_timed_idea = {
			idea = PER_sheikh_kazal_seize
			days = 365
		}
		PER_increase_two_reserve_effect = yes
	}
}

country_event = { # socialism - purge them all or nah?
	id = persia_events.34
	title = persia_events.34.t
	desc = persia_events.34.d
	picture = GFX_report_event_communists_cheer

	is_triggered_only = yes

	option = { # purge them all
		log = "[GetLogInfo]: event persia_events.34 option persia_events.34.a"
		name = persia_events.34.a
	}
}

country_event = { # jihad called by clergies
	id = persia_events.35
	title = persia_events.35.t
	desc = persia_events.35.d
	picture = GFX_report_event_soldiers_marching

	is_triggered_only = yes

	trigger = {
		has_defensive_war = yes
		NOT = {
			has_idea = PER_jihad
		}
	}

	option = {
		log = "[GetLogInfo]: event persia_events.35 option persia_events.35.a"
		name = persia_events.35.a
		add_ideas = PER_jihad
	}
}

country_event = { # war ends, no more jihad
	id = persia_events.36
	title = persia_events.36.t
	desc = persia_events.36.d

	is_triggered_only = yes

	trigger = {
		has_war = no
		has_idea = PER_jihad
	}

	option = {
		log = "[GetLogInfo]: event persia_events.36 option persia_events.36.a"
		name = persia_events.36.a
		remove_ideas = PER_jihad
	}
}

country_event = { # socialist protests
	id = persia_events.37
	title = persia_events.37.t
	desc = persia_events.37.d
	picture = GFX_report_event_worker_protests

	is_triggered_only = yes

	trigger = {
		has_idea = PER_political_upheaval
		has_socialist_government = no
	}

	option = {
		log = "[GetLogInfo]: event persia_events.37 option persia_events.37.a"
		name = persia_events.37.a
		add_stability = -0.02
		add_popularity = {
			ideology = radical_socialist
			popularity = 0.01
		}
		hidden_effect = {
			country_event = { id = persia_events.37 days = 40 random_days = 120 }
		}
	}
}

country_event = { # 1938 PRESIDENTIAL ELECTION
	id = persia_events.38
	title = persia_events.38.t
	desc = persia_events.38.d
	picture = GFX_report_event_election_vote

	is_triggered_only = yes

	trigger = {
		date < 1939.1.1
		has_completed_focus = PER_long_live_revolution
		has_elected_government = yes
	}

	option = { # Democrats win
		log = "[GetLogInfo]: event persia_events.38 option persia_events.38.a"
		name = persia_events.38.a
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_REP_SOCDEM } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_REP_SOCLIB } }
			}
		}
		set_politics = {
			ruling_party = social_democrat
			elections_allowed = yes
		}
		add_popularity = {
			ideology = social_democrat
			popularity = 0.15
		}
		add_popularity = {
			ideology = radical_socialist
			popularity = 0.05
		}
	}

	option = { # Tajadod wins
		log = "[GetLogInfo]: event persia_events.38 option persia_events.38.b"
		name = persia_events.38.b
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_MARLIB } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_REP_SOCCON } }
			}
		}
		set_politics = {
			ruling_party = market_liberal
			elections_allowed = yes
		}
		add_popularity = {
			ideology = market_liberal
			popularity = 0.35
		}
		add_popularity = {
			ideology = social_conservative
			popularity = 0.10
		}
	}

	option = { # Party for Progress wins
		log = "[GetLogInfo]: event pers.38 option pers.38.e"
		name = pers.38.i
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				OR = {
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_MARLIB }
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_SOCDEM }
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_SOCCON }
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_SOCLIB }
				}
			}
		}
		promote_character = {
    			character = PER_Abdolhossein_Teymourtash
    			ideology = national_populist
		}
		set_party_name = {
    			ideology = national_populist
   			long_name = PER_new_iran_party_long
    			name = PER_new_iran_party
		}
		set_politics = {
			ruling_party = national_populist
			elections_allowed = yes
		}
		add_popularity = {
			ideology = national_populist
			popularity = 0.35
		}
		add_popularity = {
			ideology = market_liberal
			popularity = 0.10
		}
	}

}

country_event = { # 1942 PRESIDENTIAL ELECTION
	id = persia_events.39
	title = persia_events.39.t
	desc = persia_events.39.d
	picture = GFX_report_event_election_vote

	is_triggered_only = yes

	trigger = {
		date > 1939.1.1
		date < 1943.1.1
		has_completed_focus = PER_long_live_revolution
		has_elected_government = yes
	}

	option = { # Democrats win
		log = "[GetLogInfo]: event persia_events.39 option persia_events.39.a"
		name = persia_events.39.a
		ai_chance = {
			base = 50
			modifier = {
				factor = 0.5
				has_soccon_or_marlib_government = yes
			}
			modifier = {
				factor = 0
				OR = {
					AND = {
						NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
						NOT = { has_game_rule = { rule = PER_path option = PER_PATH_REP_SOCDEM } }
						NOT = { has_game_rule = { rule = PER_path option = PER_PATH_REP_SOCLIB } }
					}
					has_game_rule = { rule = PER_new_np_path option = PER_PATH_REPUBLIC_NATPOP }
				}
			}
		}
		set_politics = {
			ruling_party = social_democrat
			elections_allowed = yes
		}
		add_popularity = {
			ideology = social_democrat
			popularity = 0.20
		}
	}

	option = { # Social Conservatives win
		log = "[GetLogInfo]: event persia_events.39 option persia_events.39.b"
		name = persia_events.39.b
		ai_chance = {
			base = 50
			modifier = {
				factor = 0.5
				has_soclib_or_socdem_government = yes
			}
			modifier = {
				factor = 0
				OR = {
					AND = {
						NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
						NOT = { has_game_rule = { rule = PER_path option = PER_PATH_MARLIB } }
						NOT = { has_game_rule = { rule = PER_path option = PER_PATH_REP_SOCCON } }
					}
					has_game_rule = { rule = PER_new_np_path option = PER_PATH_REPUBLIC_NATPOP }
				}
			}
		}
		set_politics = {
			ruling_party = social_conservative
			elections_allowed = yes
		}
		add_popularity = {
			ideology = social_conservative
			popularity = 0.30
		}
	}

	option = { # Party for Progress wins
		log = "[GetLogInfo]: event pers.38 option pers.38.e"
		name = pers.38.i
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				OR = {
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_MARLIB }
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_SOCDEM }
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_SOCLIB }
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_SOCCON }
				}
			}
		}
		set_politics = {
			ruling_party = national_populist
			elections_allowed = yes
		}
		add_popularity = {
			ideology = national_populist
			popularity = 0.30
		}
	}
}

country_event = { # 1946 PRESIDENTIAL ELECTION
	id = persia_events.40
	title = persia_events.40.t
	desc = persia_events.40.d
	picture = GFX_report_event_election_vote

	is_triggered_only = yes

	trigger = {
		date > 1943.1.1
		has_completed_focus = PER_long_live_revolution
		has_elected_government = yes
	}

	option = { # Democrats win
		log = "[GetLogInfo]: event persia_events.40 option persia_events.40.a"
		name = persia_events.40.a
		ai_chance = {
			base = 50
			modifier = {
				factor = 0.5
				has_soccon_or_marlib_government = yes
			}
			modifier = {
				factor = 0
				OR = {
					AND = {
						NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
						NOT = { has_game_rule = { rule = PER_path option = PER_PATH_REP_SOCDEM } }
					}
					has_game_rule = { rule = PER_new_np_path option = PER_PATH_REPUBLIC_NATPOP }
				}
			}
		}
		set_politics = {
			ruling_party = social_democrat
			elections_allowed = yes
		}
		add_popularity = {
			ideology = social_democrat
			popularity = 0.20
		}
	}

	option = { # Eetedaliun wins
		log = "[GetLogInfo]: event persia_events.40 option persia_events.40.b"
		name = persia_events.40.b
		ai_chance = {
			base = 50
			modifier = {
				factor = 0.5
				has_soccon_or_marlib_government = yes
			}
			modifier = {
				factor = 0
				OR = {
					AND = {
						NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
						NOT = { has_game_rule = { rule = PER_path option = PER_PATH_REP_SOCLIB } }
					}
					has_game_rule = { rule = PER_new_np_path option = PER_PATH_REPUBLIC_NATPOP }
				}
			}
		}
		set_politics = {
			ruling_party = social_liberal
			elections_allowed = yes
		}
		add_popularity = {
			ideology = social_liberal
			popularity = 0.30
		}
		add_popularity = {
			ideology = market_liberal
			popularity = 0.10
		}
	}

	option = { # Soc cons win
		log = "[GetLogInfo]: event persia_events.40 option persia_events.40.c"
		name = persia_events.40.c
		ai_chance = {
			base = 50
			modifier = {
				factor = 0.5
				has_soclib_or_socdem_government = yes
			}
			modifier = {
				factor = 0
				OR = {
					AND = {
						NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
						NOT = { has_game_rule = { rule = PER_path option = PER_PATH_REP_SOCCON } }
						NOT = { has_game_rule = { rule = PER_path option = PER_PATH_MARLIB } }
					}
					has_game_rule = { rule = PER_new_np_path option = PER_PATH_REPUBLIC_NATPOP }
				}
			}
		}
		set_politics = {
			ruling_party = social_conservative
			elections_allowed = yes
		}
		add_popularity = {
			ideology = social_conservative
			popularity = 0.20
		}
	}

	option = { # Party for Progress wins
		log = "[GetLogInfo]: event pers.38 option pers.38.e"
		name = pers.38.i
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				OR = {
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_MARLIB }
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_SOCDEM }
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_SOCLIB }
					has_game_rule = { rule = PER_path option = PER_PATH_REPUBLIC_SOCCON }
				}
			}
		}
		set_politics = {
			ruling_party = national_populist
			elections_allowed = yes
		}
		add_popularity = {
			ideology = national_populist
			popularity = 0.2
		}
	}
}

country_event = { # 1938 MAJLIS ELECTION
	id = persia_events.41
	title = persia_events.41.t
	desc = persia_events.41.d
	picture = GFX_report_event_election_vote

	is_triggered_only = yes

	trigger = {
		date < 1939.1.1
		NOT = { has_completed_focus = PER_long_live_revolution }
		has_democratic_government = yes
	}

	option = { # soc-dems
		log = "[GetLogInfo]: event persia_events.41 option persia_events.41.a"
		name = persia_events.41.a
		ai_chance = {
			base = 30
			modifier = {
				factor = 0
				NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_MON_SOCDEM } }
			}
		}
		set_politics = {
			ruling_party = social_democrat
			elections_allowed = yes
		}
		add_popularity = {
			ideology = social_democrat
			popularity = 0.20
		}
	}

	option = { # right coalition
		log = "[GetLogInfo]: event persia_events.41 option persia_events.41.b"
		name = persia_events.41.b
		ai_chance = {
			base = 40
			modifier = {
				factor = 0
				NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_MON_SOCCON } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_AUTDEM } }
			}
		}
		set_politics = {
			ruling_party = social_conservative
			elections_allowed = yes
		}
		add_popularity = {
			ideology = social_conservative
			popularity = 0.35
		}
		add_popularity = {
			ideology = authoritarian_democrat
			popularity = 0.05
		}
		add_popularity = {
			ideology = paternal_autocrat
			popularity = 0.05
		}
	}

	option = { # liberal coalition
		log = "[GetLogInfo]: event persia_events.41 option persia_events.41.c"
		name = persia_events.41.c
		ai_chance = {
			base = 30
			modifier = {
				factor = 0
				NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_MON_SOCLIB } }
			}
		}
		set_politics = {
			ruling_party = social_liberal
			elections_allowed = yes
		}
		add_popularity = {
			ideology = social_liberal
			popularity = 0.30
		}
		add_popularity = {
			ideology = social_democrat
			popularity = 0.10
		}
		add_popularity = {
			ideology = market_liberal
			popularity = 0.10
		}
	}
}

country_event = { # 1942 MAJLIS ELECTION
	id = persia_events.42
	title = persia_events.42.t
	desc = persia_events.42.d
	picture = GFX_report_event_election_vote

	is_triggered_only = yes

	trigger = {
		date > 1939.1.1
		date < 1943.1.1
		NOT = { has_completed_focus = PER_long_live_revolution }
		has_democratic_government = yes
	}

	option = { # soc-dems
		log = "[GetLogInfo]: event persia_events.42 option persia_events.42.a"
		name = persia_events.42.a
		ai_chance = {
			base = 30
			modifier = {
				factor = 0.5
				has_soccon_or_marlib_government = yes
			}
			modifier = {
				factor = 0
				NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_MON_SOCDEM } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_MON_SOCLIB } }
			}
		}
		set_politics = {
			ruling_party = social_democrat
			elections_allowed = yes
		}
		add_popularity = {
			ideology = social_democrat
			popularity = 0.20
		}
		add_popularity = {
			ideology = market_liberal
			popularity = 0.05
		}
	}

	option = { # soc-cons
		log = "[GetLogInfo]: event persia_events.42 option persia_events.42.b"
		name = persia_events.42.b
		ai_chance = {
			base = 40
			modifier = {
				factor = 0.5
				has_soclib_or_socdem_government = yes
			}
			modifier = {
				factor = 0
				NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_MON_SOCCON } }
			}
		}
		set_politics = {
			ruling_party = social_conservative
			elections_allowed = yes
		}
		add_popularity = {
			ideology = social_conservative
			popularity = 0.20
		}
	}

	option = { # right coalition
		log = "[GetLogInfo]: event persia_events.42 option persia_events.42.c"
		name = persia_events.42.c
		ai_chance = {
			base = 30
			modifier = {
				factor = 0.5
				has_soclib_or_socdem_government = yes
			}
			modifier = {
				factor = 0
				NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_AUTDEM } }
			}
		}
		set_politics = {
			ruling_party = authoritarian_democrat
			elections_allowed = yes
		}
		add_popularity = {
			ideology = authoritarian_democrat
			popularity = 0.25
		}
		add_popularity = {
			ideology = paternal_autocrat
			popularity = 0.05
		}
		add_popularity = {
			ideology = market_liberal
			popularity = 0.10
		}
	}
}

country_event = { # 1946 MAJLIS ELECTION
	id = persia_events.43
	title = persia_events.43.t
	desc = persia_events.43.d
	picture = GFX_report_event_election_vote

	is_triggered_only = yes

	trigger = {
		date > 1943.1.1
		NOT = { has_completed_focus = PER_long_live_revolution }
		has_democratic_government = yes
	}

	option = { # soc-dems
		log = "[GetLogInfo]: event persia_events.43 option persia_events.43.a"
		name = persia_events.43.a
		ai_chance = {
			base = 30
			modifier = {
				factor = 0.5
				has_soccon_or_marlib_government = yes
			}
			modifier = {
				factor = 0
				NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_MON_SOCDEM } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_MON_SOCLIB } }
			}
		}
		set_politics = {
			ruling_party = social_democrat
			elections_allowed = yes
		}
		add_popularity = {
			ideology = social_democrat
			popularity = 0.20
		}
	}

	option = { # soc-cons
		log = "[GetLogInfo]: event persia_events.43 option persia_events.43.b"
		name = persia_events.43.b
		ai_chance = {
			base = 40
			modifier = {
				factor = 0.5
				has_soclib_or_socdem_government = yes
			}
			modifier = {
				factor = 0
				NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_MON_SOCCON } }
			}
		}
		set_politics = {
			ruling_party = social_conservative
			elections_allowed = yes
		}
		add_popularity = {
			ideology = social_conservative
			popularity = 0.20
		}
	}

	option = { # right coalition
		log = "[GetLogInfo]: event persia_events.43 option persia_events.43.c"
		name = persia_events.43.c
		ai_chance = {
			base = 30
			modifier = {
				factor = 0.5
				has_democratic_government = yes
			}
			modifier = {
				factor = 0
				NOT = { has_game_rule = { rule = PER_path option = DEFAULT } }
				NOT = { has_game_rule = { rule = PER_path option = PER_PATH_AUTDEM } }
			}
		}
		set_politics = {
			ruling_party = authoritarian_democrat
			elections_allowed = yes
		}
		add_popularity = {
			ideology = authoritarian_democrat
			popularity = 0.25
		}
		add_popularity = {
			ideology = paternal_autocrat
			popularity = 0.05
		}
		add_popularity = {
			ideology = market_liberal
			popularity = 0.10
		}
	}
}

country_event = { # demand bahrain from whoever owns it
	id = persia_events.67
	title = persia_events.67.t
	desc = persia_events.67.d

	is_triggered_only = yes

	option = { # give it up
		log = "[GetLogInfo]: event persia_events.67 option persia_events.67.a"
		name = persia_events.67.a
		ai_chance = { base = 40 }
		PER = {
			country_event = { id = persia_events.68 days = 1 }
		}
	}

	option = { # we will fight for it
		log = "[GetLogInfo]: event persia_events.67 option persia_events.67.b"
		name = persia_events.67.b
		ai_chance = {
			base = 60
			modifier = {
				factor = 0
				enemies_strength_ratio > 0.5
			}
			modifier = {
				factor = 0
				strength_ratio = { tag = FROM ratio < 1 }
			}
			modifier = {
				factor = 0
				is_in_faction = no
				FROM = { is_in_faction = yes }
			}
		}
		PER = {
			country_event = { id = persia_events.69 days = 1 }
		}
	}
}

country_event = { # they cede bahrain
	id = persia_events.68
	title = persia_events.68.t
	desc = persia_events.68.d

	is_triggered_only = yes

	option = { # cool
		log = "[GetLogInfo]: event persia_events.68 option persia_events.68.a"
		name = persia_events.68.a
		transfer_state = 907
	}
}

country_event = { # they dont cede bahrain
	id = persia_events.69
	title = persia_events.69.t
	desc = persia_events.69.d

	is_triggered_only = yes

	option = { # war!
		log = "[GetLogInfo]: event persia_events.69 option persia_events.69.a"
		name = persia_events.69.a
		PER = {
			declare_war_on = {
				target = FROM
				type = annex_everything
			}
			PER_puppet_KUR = yes
		}
	}
}

country_event = { #The Annexation of Sulaymaniyah
	id = persia_events.70
	title = persia_events.70.t
	desc = persia_events.70.d

	picture = GFX_OTT_Sheikh_Sait

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.70 option persia_events.70.a"
		name = persia_events.70.a
		annex_country = {
			target = KUR
			transfer_troops = no
		}
		819 = { #Sulaymaniyah
			add_claim_of_ROOT = yes
			add_resistance = 35
		}
	}
}

country_event = { #EVENT FOR IRAN - peace with Russia in our favour?
	id = persia_events.80
	title = persia_events.80.t
	desc = persia_events.80.d

	fire_only_once = yes

	trigger = {
		original_tag = PER
		has_war_with = var:global.russia
		var:global.russia = {
			if = {
				limit = { has_war_with_major = yes }
				surrender_progress > 0.2
			}
			else = {
				surrender_progress > 0.1
			}
			is_valid_peace_target = yes
		}
		is_valid_peace_target = yes
		surrender_progress < 0.2
		if = {
			limit = { var:229.owner = { is_ally_with = var:global.russia } } #Azerbaijan
			is_ally_with = 229.controller
		}
		if = {
			limit = { var:231.owner = { is_ally_with = var:global.russia } } #Georgia
			is_ally_with = 231.controller
		}
		if = {
			limit = { var:405.owner = { is_ally_with = var:global.russia } } #Bukhara
			is_ally_with = 405.controller
		}
		if = {
			limit = { var:732.owner = { is_ally_with = var:global.russia } } #Samarkand
			is_ally_with = 732.controller
		}
		if = {
			limit = { var:861.owner = { is_ally_with = var:global.russia } } #Khorezm
			is_ally_with = 861.controller
		}
	}

	option = { # offer peace
		log = "[GetLogInfo]: event persia_events.80 option persia_events.80.a"
		name = persia_events.80.a
		var:global.russia = {
			country_event = { id = persia_events.81 days = 1 }
		}
	}

	option = { # never
		log = "[GetLogInfo]: event persia_events.80 option persia_events.80.b"
		name = persia_events.80.b
		ai_chance = { base = 0 }
		add_stability = -0.1
	}
}

country_event = { #EVENT FOR RUSSIA - peace with iran in their favour?
	id = persia_events.81
	title = persia_events.81.t
	desc = persia_events.81.d

	is_triggered_only = yes

	option = { # accept peace
		log = "[GetLogInfo]: event persia_events.81 option persia_events.81.a"
		name = persia_events.81.a
		every_other_country = {
			limit = {
				OR = {
					tag = GEO
					tag = AZR
					tag = ARM
					tag = KHI
					tag = TRK
					tag = BUK
				}
				is_ally_with = ROOT
			}
			if = {
				limit = { is_subject = yes }
				overlord = {
					set_autonomy = {
						target = PREV
						autonomy_state = autonomy_free
					}
				}
			}
			leave_faction = yes
		}
		every_owned_state = {
			limit = {
				OR = {
					is_southern_central_asia = yes
					region = 134 #Transcaucasia
					state = 232 #Dagestan
					state = 961 #Chechnya
				}
			}
			transfer_state_to = FROM
		}
		FROM = {
			white_peace_with_ROOT = yes
			set_truce = { target = ROOT days = 730 }
			diplomatic_relation = {
				country = ROOT
				relation = non_aggression_pact
			}
		}
	}

	option = { # never
		log = "[GetLogInfo]: event persia_events.81 option persia_events.81.b"
		name = persia_events.81.b
		ai_chance = { base = 0 }
		add_stability = -0.1
	}
}

country_event = { #peace with entente
	id = persia_events.82
	title = persia_events.82.t
	desc = persia_events.82.d

	trigger = {
		tag = PER
		has_war_with = RAJ
		controls_state = 444
		RAJ = {
			owns_state = 444
			if = {
				limit = {
					OR = {
						has_war_with = HND
						has_war_with = PRF
					}
				}
				surrender_progress > 0.4
			}
			else = {
				surrender_progress > 0.8
			}
		}
		is_valid_peace_target = yes
		surrender_progress < 0.2
		if = {
			limit = { AFG = { is_ally_with = RAJ } }
			controls_state = 267 # Kabul
		}
	}

	fire_only_once = yes

	option = {
		log = "[GetLogInfo]: event persia_events.82 option persia_events.82.a"
		name = persia_events.82.a #Propose peace
		RAJ = {
			if = {
				limit = { is_in_faction = yes }
				faction_leader = { country_event = persia_events.83 }
			}
			else_if = {
				limit = { is_subject = yes }
				overlord = { country_event = persia_events.83 }
			}
			else = { country_event = persia_events.83 }
		}
	}
	option = {
		log = "[GetLogInfo]: event persia_events.82 option persia_events.82.b"
		name = persia_events.82.b #We shall fight on!
		ai_chance = { base = 0 }
		add_stability = -0.3
	}
}

country_event = { # peace with iran
	id = persia_events.83
	title = persia_events.83.t
	desc = persia_events.83.d

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.83 option persia_events.83.a"
		name = persia_events.83.a #We have no choice but to accept
		if = {
			limit = { has_subject = AFG }
			set_autonomy = {
				target = AFG
				autonomy_state = autonomy_free
			}
		}
		if = {
			limit = { is_in_faction_with = AFG }
			AFG = { leave_faction = yes }
		}
		FROM = {
			transfer_state = 444 #Baluchistan
			white_peace_with_ROOT = yes
		}
	}

	option = {
		log = "[GetLogInfo]: event persia_events.83 option persia_events.83.b"
		name = persia_events.83.b #No! The Delhi Government shall be restored!
		ai_chance = { base = 0 }
		add_stability = -0.05
	}
}

country_event = { #nowruz
	id = persia_events.85
	title = persia_events.85.t
	desc = persia_events.85.d
	picture = GFX_report_event_crowd_in_prague

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			country_event = { id = persia_events.85 days = 730 }
		}
	}

	option = {
		log = "[GetLogInfo]: event persia_events.85 option persia_events.85.a"
		name = persia_events.85.a
		add_political_power = 15
	}
}

country_event = { #peace with germans
	id = persia_events.87
	title = persia_events.87.t
	desc = persia_events.87.d

	fire_only_once = yes

	trigger = {
		original_tag = PER
		has_war_with = GER
		is_valid_peace_target = yes
		GER = {
			is_valid_peace_target = yes
			OR = {
				is_in_faction_with = AZR
				is_in_faction_with = GEO
			}
			NOT = { is_in_faction_with = OTT }
			if = {
				limit = {
					OR = {
						is_in_faction_with = AZR
						has_guaranteed = AZR
					}
				}
				AZR = { has_capitulated = yes }
				var:229.controller = { is_ally_with = ROOT }
			}
			else_if = {
				limit = {
					OR = {
						is_in_faction_with = 229.owner
						has_guaranteed = 229.owner
					}
				}
				var:229.controller = { is_ally_with = ROOT }
			}
			if = {
				limit = {
					OR = {
						is_in_faction_with = GEO
						has_guaranteed = GEO
					}
				}
				GEO = { has_capitulated = yes }
				var:231.controller = { is_ally_with = ROOT }
			}
			else_if = {
				limit = {
					OR = {
						is_in_faction_with = 231.owner
						has_guaranteed = 231.owner
					}
				}
				var:231.controller = { is_ally_with = ROOT }
			}
			if = {
				limit = {
					OR = {
						is_in_faction_with = ARM
						has_guaranteed = ARM
					}
				}
				ARM = { has_capitulated = yes }
				var:230.controller = { is_ally_with = ROOT }
			}
			else_if = {
				limit = {
					OR = {
						is_in_faction_with = 230.owner
						has_guaranteed = 230.owner
					}
				}
				var:230.controller = { is_ally_with = ROOT }
			}
		}
	}

	option = {
		log = "[GetLogInfo]: event persia_events.87 option persia_events.87.a"
		name = persia_events.87.a #Propose peace
		GER = { country_event = { id = persia_events.88 days = 1 } }
	}
	option = {
		log = "[GetLogInfo]: event persia_events.87 option persia_events.87.b"
		name = persia_events.87.b #We shall fight on!
		ai_chance = { base = 0 }
		add_stability = -0.3
	}
}

country_event = { # peace with iran
	id = persia_events.88
	title = persia_events.88.t
	desc = persia_events.88.d

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.88 option persia_events.88.a"
		name = persia_events.88.a #We accept
		if = {
			limit = { has_subject = AZR }
			set_autonomy = {
				target = AZR
				autonomy_state = autonomy_free
			}
		}
		if = {
			limit = { is_in_faction_with = AZR }
			AZR = { leave_faction = yes }
		}
		else_if = {
			limit = { is_in_faction_with = 229.owner }
			229 = { transfer_state_to = FROM }
			if = {
				limit = {
					is_in_faction_with = 998.owner
					var:998.controller = {
						OR = {
							is_ally_with = ROOT
							is_ally_with = FROM
						}
					}
				}
				998 = { transfer_state_to = FROM }
			}
		}
		FROM = { white_peace_with_ROOT = yes }
	}

	option = {
		log = "[GetLogInfo]: event persia_events.88 option persia_events.88.b"
		name = persia_events.88.b #No!
		ai_chance = { base = 0 }
		add_stability = -0.1
	}
}

country_event = { # Dehkhoda's Dictionary
	id = persia_events.89
	title = persia_events.89.t
	desc = persia_events.89.d
	picture = GFX_report_event_generic_read_write

	fire_only_once = yes
	is_triggered_only = yes

	option = { # good job bud
		log = "[GetLogInfo]: event persia_events.89 option persia_events.89.a"
		name = persia_events.89.a
	}

	option = { # fund it for all of iran
		log = "[GetLogInfo]: event persia_events.89 option persia_events.89.b"
		name = persia_events.89.b
		add_stability = 0.02
		add_political_power = -10
	}
}

country_event = { #Persepolis Excavation
	id = persia_events.90
	title = persia_events.90.t
	desc = persia_events.90.d
	picture = GFX_report_event_generic_ruins

	fire_only_once = yes
	is_triggered_only = yes

	option = { # regulate but yes
		log = "[GetLogInfo]: event persia_events.90 option persia_events.90.a"
		name = persia_events.90.a
		add_stability = 0.05
		add_political_power = 50
		add_timed_idea = {
			idea = PER_regulating_excavation
			days = 60
		}
	}

	option = { # yes
		log = "[GetLogInfo]: event persia_events.90 option persia_events.90.b"
		name = persia_events.90.b
		add_stability = 0.02
		add_political_power = 25
	}

	option = { # no
		log = "[GetLogInfo]: event persia_events.90 option persia_events.90.c"
		name = persia_events.90.c
	}
}

country_event = { # Muharram
	id = persia_events.91
	title = persia_events.91.t
	desc = persia_events.91.d
	picture = GFX_report_event_gathering_protest

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			country_event = { id = persia_events.91 days = 709 }
		}
	}

	option = {
		log = "[GetLogInfo]: event persia_events.91 option persia_events.91.a"
		name = persia_events.91.a
	}
}

country_event = { # ramadan
	id = persia_events.97
	title = persia_events.97.t
	desc = persia_events.97.d
	picture = GFX_report_event_crowd_in_prague

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			country_event = { id = persia_events.97 days = 709 }
		}
	}

	option = {
		log = "[GetLogInfo]: event persia_events.97 option persia_events.97.a"
		name = persia_events.97.a
		add_stability = 0.01
	}
}

country_event = { #yalda night
	id = persia_events.99
	title = persia_events.99.t
	desc = persia_events.99.d
	picture = GFX_report_event_crowd_in_prague

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			country_event = { id = persia_events.99 days = 365 }
		}
	}

	option = {
		log = "[GetLogInfo]: event persia_events.99 option persia_events.99.a"
		name = persia_events.99.a
		add_stability = 0.01
	}
}
country_event = { #rostam the bear 1
	id = persia_events.101
	title = persia_events.101.t
	desc = persia_events.101.d
	picture = GFX_report_event_spain_civil_war_volunteers_02

	fire_only_once = yes
	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.101 option persia_events.101.a"
		name = persia_events.101.a
		add_stability = 0.02
		hidden_effect = {
			country_event = { id = persia_events.102 days = 300 }
		}
	}
}

country_event = { #rostam the bear 2
	id = persia_events.102
	title = persia_events.102.t
	desc = persia_events.102.d
	picture = GFX_report_event_british_artillery

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.102 option persia_events.102.a"
		name = persia_events.102.a
		add_stability = 0.02
		hidden_effect = {
			country_event = { id = persia_events.103 days = 100 }
		}
	}
}

country_event = { #rostam the bear 3
	id = persia_events.103
	title = persia_events.103.t
	desc = persia_events.103.d
	picture = GFX_report_event_soviet_german_soldier_handshake

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.103 option persia_events.103.a"
		name = persia_events.103.a
		add_stability = -0.02
		hidden_effect = {
			country_event = { id = persia_events.104 days = 50 }
		}
	}

	option = {
		log = "[GetLogInfo]: event persia_events.103 option persia_events.103.b"
		name = persia_events.103.b
		add_political_power = -25
	}
}

country_event = { #rostam the bear 4
	id = persia_events.104
	title = persia_events.104.t
	desc = persia_events.104.d
	picture = GFX_report_event_german_polish_border

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.104 option persia_events.104.a"
		name = persia_events.104.a
		add_political_power = 25
	}
}

country_event = { #PER asks to join Internationale
	id = persia_events.105
	title = persia_events.105.t
	desc = persia_events.105.d
	picture = GFX_report_event_generic_diplomacy2

	is_triggered_only = yes

	option = { #Sure
		log = "[GetLogInfo]: event persia_events.105 option persia_events.105.a"
		name = persia_events.105.a
		hidden_effect = {
			if = {
				limit = { FROM = { is_faction_leader = yes } }
				save_event_target_as = future_persian_faction_leader
				every_other_country = {
					limit = {
						is_in_faction_with = FROM
						is_subject = no
					}
					if = {
						limit = { has_socialist_government = no }
						country_event = persia_events.123
					}
					else = {
						country_event = persia_events.125
					}
				}
				FROM = { dismantle_faction = yes }
			}
		}
		add_to_faction = FROM
		FROM = { country_event = { id = persia_events.106 days = 2 } }
	}

	option = { #No
		log = "[GetLogInfo]: event persia_events.105 option persia_events.105.b"
		name = persia_events.105.b
		ai_chance = { base = 0 }
		FROM = { country_event = { id = persia_events.107 days = 2 } }
	}
}

country_event = { #INT accepts
	id = persia_events.106
	title = persia_events.106.t
	desc = persia_events.106.d
	picture = GFX_report_event_generic_diplomacy2

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.106 option persia_events.106.a"
		name = persia_events.106.a
		effect_tooltip = { var:FROM.faction_leader = { add_to_faction = ROOT } }
	}

}

country_event = { #INT declines
	id = persia_events.107
	title = persia_events.107.t
	desc = persia_events.107.d
	picture = GFX_report_event_generic_diplomacy2

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.107 option persia_events.107.a"
		name = persia_events.107.a
		add_political_power = -10
	}

}

# Republican Revolution!
news_event = {
	id = persia_events.110
	immediate = { log = "[GetLogInfo]: event persia_events.110" }
	title = persia_events.110.t
	desc = persia_events.110.d
	picture = GFX_news_event_PER_republic

	trigger = { wants_world_news = yes }

	is_triggered_only = yes
	fire_for_sender = no
	major = yes

	show_major = { regional_middle_east_news = yes }

	option = {
		name = persia_events.110.a
	}
}

# Socialist Revolution
news_event = {
	id = persia_events.111
	immediate = { log = "[GetLogInfo]: event persia_events.111" }
	title = persia_events.111.t
	desc = persia_events.111.d
	picture = GFX_news_event_PER_socialist

	trigger = { wants_world_news = yes }

	is_triggered_only = yes
	fire_for_sender = no
	major = yes

	show_major = {
		OR = {
			regional_middle_east_news = yes
			has_socialist_government = yes
		}
	}

	option = {
		name = persia_events.111.a
		trigger = {
			has_socialist_government = no
		}
	}

	option = {
		name = persia_events.111.b
		trigger = {
			has_socialist_government = yes
		}
	}
}

country_event = { #[PER.GetName] Asks For an Alliance - for RUS
	id = persia_events.120
	title = persia_events.120.t
	desc = {
		text = persia_events.120.d.base
		trigger = {
			NOT = {
				FROM = { owns_state = 418 } #Ashkhabad
			}
		}
	}
	desc = {
		text = persia_events.120.d.ashkhabad
		trigger = {
			FROM = { owns_state = 418 } #Ashkhabad
		}
	}
	picture = GFX_report_event_generic_diplomacy2

	is_triggered_only = yes

	option = { #Such are the fruits of good relations.
		log = "[GetLogInfo]: event persia_events.120 option persia_events.120.a"
		name = persia_events.120.a
		FROM = {
			country_event = persia_events.121
			event_option_tooltip = persia_events.121.a
		}
	}

	option = { #Seems unnecessary.
		log = "[GetLogInfo]: event persia_events.120 option persia_events.120.b"
		name = persia_events.120.b
		ai_chance = { base = 0 }
		FROM = { country_event = persia_events.122 }
	}
}

country_event = { #Russia Accepts Our Offer For an Alliance
	id = persia_events.121
	title = persia_events.121.t
	desc = {
		text = persia_events.121.d.base
		trigger = {
			NOT = {
				owns_state = 418 #Ashkhabad
			}
		}
	}
	desc = {
		text = persia_events.121.d.ashkhabad
		trigger = {
			owns_state = 418 #Ashkhabad
		}
	}
	picture = GFX_report_event_generic_diplomacy2

	is_triggered_only = yes

	option = { #May it last for ages to come.
		log = "[GetLogInfo]: event persia_events.121 option persia_events.121.a"
		name = persia_events.121.a
		418 = { #Ashkhabad
			if = {
				limit = { is_owned_by = PER }
				remove_core_of = PER
				transfer_state_to = 584.owner #Karakum
			}
		}
		hidden_effect = {
			if = {
				limit = { is_faction_leader = yes }
				FROM = { save_event_target_as = future_persian_faction_leader }
				every_other_country = {
					limit = {
						is_in_faction_with = ROOT
						is_subject = no
					}
					if = {
						limit = { has_socialist_government = yes }
						country_event = persia_events.123
					}
					else = {
						country_event = persia_events.125
					}
				}
				dismantle_faction = yes
			}
		}
		FROM = { add_to_faction = ROOT }
		hidden_effect = { complete_national_focus = PER_join_moscow_accord }
	}
}

country_event = { #Russia Denies Our Request
	id = persia_events.122
	title = persia_events.122.t
	desc = persia_events.122.d
	picture = GFX_report_event_generic_diplomacy2

	is_triggered_only = yes

	option = { #Whatever.
		log = "[GetLogInfo]: event persia_events.122 option persia_events.122.a"
		name = persia_events.122.a
		clr_country_flag = PER_align_with_RUS
		set_country_flag = PER_RUS_refused_alliance_offer
		PER_forpol_setup = yes #Choose between neutrality or RP alignment
	}
}

country_event = { #Iran Discontinues the Tabriz Accords
	id = persia_events.123
	title = persia_events.123.t
	desc = persia_events.123.d
	picture = GFX_report_event_generic_diplomacy2

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.123 option persia_events.123.a"
		name = persia_events.123.a
		clr_country_flag = non_ideological_faction_member
	}
}

country_event = { #Capitulation of Iran - Collapse of the Tabriz Accords
	id = persia_events.124
	title = persia_events.124.t
	desc = persia_events.124.d
	picture = GFX_OTT_Troops_Istanbul

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.124 option persia_events.124.a"
		name = persia_events.124.a
		custom_effect_tooltip = PER_tabriz_accords_capitulation_tt
		custom_effect_tooltip = tooltip_white_line
		add_stability = -0.05
		add_war_support = -0.05
		clr_country_flag = non_ideological_faction_member
	}
}

country_event = { #Persia joins major faction - event for allies to determine whether to join too
	id = persia_events.125
	title = persia_events.125.t
	desc = persia_events.125.d
	picture = GFX_report_event_generic_diplomacy2

	trigger = {
		has_event_target = future_persian_faction_leader
	}

	is_triggered_only = yes

	option = { # Yes
		log = "[GetLogInfo]: event persia_events.125 option persia_events.125.a"
		name = persia_events.125.a
		ai_chance = {
			base = 30
			modifier = {
				factor = 0
				tag = ARM
				OR = {
					AND = {
						has_socialist_government = no
						OR = {
							has_game_rule = { rule = ARM_path option = ARM_PATH_RADSOC }
							has_game_rule = { rule = ARM_path option = ARM_PATH_TOTALIST }
						}
					}
					AND = {
						has_game_rule = { rule = ARM_forpol option = ARM_FORPOL_GER }
						event_target:future_persian_faction_leader = { is_german_unifier_tag = no }
					}
					AND = {
						has_game_rule = { rule = ARM_forpol option = ARM_FORPOL_RUS }
						event_target:future_persian_faction_leader = { is_russian_tag = no }
					}
					AND = {
						has_game_rule = { rule = ARM_forpol option = ARM_FORPOL_INT }
						event_target:future_persian_faction_leader = {
							NOT = { tag = INT }
							is_russian_tag = no
						}
					}
				}
			}
		}
		event_target:future_persian_faction_leader = { country_event = { id = persia_events.126 hours = 8 } }
	}

	option = { # No
		log = "[GetLogInfo]: event persia_events.125 option persia_events.125.b"
		name = persia_events.125.b
		ai_chance = {
			base = 70
			modifier = {
				factor = 0
				tag = ARM
				if = {
					limit = { has_socialist_government = no }
					NOT = { has_game_rule = { rule = ARM_path option = ARM_PATH_RADSOC } }
					NOT = { has_game_rule = { rule = ARM_path option = ARM_PATH_TOTALIST } }
				}
				OR = {
					has_game_rule = { rule = ARM_forpol option = ARM_FORPOL_PER }
					AND = {
						has_game_rule = { rule = ARM_forpol option = ARM_FORPOL_GER }
						event_target:future_persian_faction_leader = { is_german_unifier_tag = yes }
					}
					AND = {
						has_game_rule = { rule = ARM_forpol option = ARM_FORPOL_RUS }
						event_target:future_persian_faction_leader = { is_russian_tag = yes }
					}
					AND = {
						has_game_rule = { rule = ARM_forpol option = ARM_FORPOL_INT }
						event_target:future_persian_faction_leader = {
							OR = {
								is_russian_tag = yes
								tag = INT
							}
						}
					}
				}
			}
		}
	}

	after = {
		clr_country_flag = non_ideological_faction_member
	}
}

country_event = { #Iran's allies seek to join faction
	id = persia_events.126
	title = persia_events.126.t
	desc = persia_events.126.d
	picture = GFX_report_event_generic_diplomacy2

	is_triggered_only = yes

	option = { # Yes
		log = "[GetLogInfo]: event persia_events.126 option persia_events.126.a"
		name = persia_events.126.a
		ai_chance = { base = 100 }
		add_to_faction = FROM
		FROM = { country_event = persia_events.127 }
	}
	option = { # No
		log = "[GetLogInfo]: event persia_events.126 option persia_events.126.b"
		name = persia_events.126.b
		ai_chance = { base = 0 }
		FROM = { country_event = persia_events.128 }
	}
}

country_event = { #Iran's allies joined faction
	id = persia_events.127
	title = persia_events.127.t
	desc = persia_events.127.d
	picture = GFX_report_event_generic_diplomacy3

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.127 option persia_events.127.a"
		name = persia_events.127.a
	}
}

country_event = { #Iran's allies denied faction entry
	id = persia_events.128
	title = persia_events.128.t
	desc = persia_events.128.d

	is_triggered_only = yes

	option = {
		log = "[GetLogInfo]: event persia_events.128 option persia_events.128.a"
		name = persia_events.128.a
	}
}
